<template>
  <div id="huishangdiv">
  <el-tabs v-model="activeNameHuishang" @tab-click="tabClick" tab-position="left">
    <el-tab-pane name="HS_HuiYiYiCheng">
      <span slot="label">会议议程 <i class="el-icon-caret-bottom"></i></span>
      <el-form :model="huishangdata.HS_HuiYiYiCheng" label-width="150px" :inline="true" v-if="huishangdata.HS_HuiYiYiCheng" id="huiyiyicheng">
          <el-button  @click="pinggushow()" style="right:60px;position:fixed;z-index:999" type="success">查看质量评估</el-button>
          <el-form-item label="会议时间：" style="width:500px;">
            <b>{{MyGetDateStr(huishangdata.HS_HuiYiYiCheng.shijian)}}</b>
          </el-form-item>
          <el-form-item label="会议地点：" style="width:500px;">
            <b>{{huishangdata.HS_HuiYiYiCheng.didian}}</b>
          </el-form-item>
          <div></div>
          <el-form-item label="应到人数：" style="width:500px;clear:both">
            <b>{{huishangdata.HS_HuiYiYiCheng.yingdaorenshu}}</b>
          </el-form-item>
          <el-form-item label="实到人数：" style="width:500px;">
            <b>{{huishangdata.HS_HuiYiYiCheng.shidaorenshu}}</b>
          </el-form-item>
          <div></div>
          <el-form-item label="主持人：" style="width:1000px;">
            <b v-for="(item, index) in huishangdata.HS_HuiYiYiCheng.Zhuchiren" :key="index" keys>{{item}}<br></b>
          </el-form-item>
          <el-form-item label="出席人员：" style="width:1000px;">
            <b v-for="(item, index) in huishangdata.HS_HuiYiYiCheng.Chuxirenyuan" :key="index" keys>{{item}}<br></b>
          </el-form-item>
          <el-form-item label="列席人员：" style="width:1000px;">
            <b>{{huishangdata.HS_HuiYiYiCheng.liexirenyuan}}</b>
          </el-form-item>
          <el-form-item label="缺席人员：" style="width:1000px;">
            <b v-for="(item, index) in huishangdata.HS_HuiYiYiCheng.Quexirenyuan" :key="index" keys>{{item}}<br></b>
          </el-form-item>
          <el-form-item label="缺席人员提交书面发言材料名单：" style="width:1000px;clear:both" label-width="270px">
            <b>{{huishangdata.HS_HuiYiYiCheng.quexishumianmingdan}}</b>
          </el-form-item>
      </el-form>
      <el-form v-else style="padding:20px; font-size:14px;color:#999;text-align:center">暂无数据</el-form>
        <div v-if="huishangdata.HS_HuiYiYiCheng2&&huishangdata.HS_HuiYiYiCheng2.length>0">
          <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
          <h1>会议议程</h1>
          <el-table :data="huishangdata.HS_HuiYiYiCheng2" highlight-current-row v-loading="listLoading" style="width: 100%;">
            <el-table-column prop="Name" label="议程" width="100">
            </el-table-column>
            <el-table-column prop="Yicheng" label="主要内容">
            </el-table-column>
          </el-table>
        </div>
        <div v-if="huishangdata.HS_LingDaoCanHui&&huishangdata.HS_LingDaoCanHui.length>0">
          <h1>部领导和驻部纪检监察组、部人事司、机关党委、督导组参会情况</h1>
          <el-table :data="huishangdata.HS_LingDaoCanHui" highlight-current-row v-loading="listLoading" style="width: 100%;">
            <el-table-column type="index" label="序号" width="70">
            </el-table-column>
            <el-table-column prop="Bumen" label="部门" width="150">
            </el-table-column>
            <el-table-column prop="Name" label="姓名" width="100">
            </el-table-column>
            <el-table-column prop="Zhiwu" label="职务">
            </el-table-column>
            <el-table-column prop="Remark" label="备注" width="100">
            </el-table-column>
          </el-table>
        </div>
    </el-tab-pane>
    <el-tab-pane name="HS_BanZiWenTi">
      <span slot="label">上年班子问&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>题整改落实 <i class="el-icon-caret-bottom"></i></span>
          <div v-if="huishangdata.HS_BanZiWenTi && huishangdata.HS_BanZiWenTi.length > 0">
          <el-button  @click="pinggushow()" style="right:60px;position:fixed;z-index:999" type="success">查看质量评估</el-button>
            <el-card v-for="(item, index) in huishangdata.HS_BanZiWenTi" :key="index" keys class="" style="margin:20px 0 0 0;clear:both;overflow:hidden">
              <div slot="header" class="clearfix">
                <span><b>上年存在问题&nbsp;{{index+1}}：</b>{{item.Wenti}}</span>
              </div>
              <div class="text item" style="line-height:180%">
                <span><b>问题类型：</b>{{item.Leixing}}</span>
              </div>
              <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
              <div class="text item" style="line-height:180%;font-weight:bolder">
                整改措施及落实情况：
              </div>
              <div class="text item" style="line-height:180%">
                {{item.Cuoshi}}
              </div>
              <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
              <div class="text item" style="line-height:180%">
                <span><b>是否完成：</b>{{item.Shifouwancheng}}</span>
              </div>
              <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
              <div class="text item" style="line-height:180%;font-weight:bolder">
                备注：
              </div>
              <div class="text item" style="line-height:180%">
                {{item.Remark}}
              </div>
            </el-card>
          </div>
          <div v-else style="padding:20px; font-size:14px;color:#999;text-align:center">暂无数据</div>
    </el-tab-pane>
    <el-tab-pane name="HS_ZiWoPiPing">
      <span slot="label">自我批评 <i class="el-icon-caret-bottom"></i></span>
      <div v-if="huishangdata.HS_ZiWoPiPing && huishangdata.HS_ZiWoPiPing.length > 0">
          <el-button  @click="pinggushow()" style="right:60px;position:fixed;z-index:999" type="success">查看质量评估</el-button>
        <el-radio-group v-model="zwpipingren" style="margin:20px">
          <el-radio-button label="全部"></el-radio-button>
          <el-radio-button v-for="(item, index) in huishangdata.LingDaoName" :key="index" keys :label="item.Name" ></el-radio-button>
        </el-radio-group> 共 <b>{{SumZiwopipingWenti}}</b> 条问题
        <el-card v-for="(item, index) in zwfilterList" :key="index" keys class="" style="margin:0 0 20px 0">
          <div slot="header" class="clearfix">
            <span><b>班子成员姓名：</b><font style="color:#00f">{{item.BanziPersonName}}</font></span>
          </div>
          <div class="text item" style="line-height:180%;font-weight:bolder">
            自我批评-查摆问题（{{item.Tiaoshu}}条）：
          </div>
          <div class="text item" style="line-height:180%" v-html="item.Wenti">
          </div>
          <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
          <div class="text item" style="line-height:180%;font-weight:bolder">
            自我批评-原因剖析：
          </div>
          <div class="text item" style="line-height:180%" v-html="item.Yuanyin">
          </div>
          <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
          <div class="text item" style="line-height:180%;">
            <span><b>是否坚持问题导向、严字当头：</b><font>{{item.Shifouwentidaoxiang}}</font></span>
          </div>
          <div class="text item" style="line-height:180%;">
            <span><b>是否实实在在谈问题、讲不足：</b><font>{{item.Shifoushishizaizai}}</font></span>
          </div>
          <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
          <div class="text item" style="line-height:180%;font-weight:bolder">
            备注：
          </div>
          <div class="text item" style="line-height:180%">
            {{item.Remark}}
          </div>
        </el-card>
      </div>
      <div v-else style="padding:20px; font-size:14px;color:#999;text-align:center">暂无数据</div>
    </el-tab-pane>
    <el-tab-pane name="HS_PiPing">
      <span slot="label">相互批评 <i class="el-icon-caret-bottom"></i></span>
      <div v-if="huishangdata.HS_PiPing && huishangdata.HS_PiPing.length > 0">
          <el-button  @click="pinggushow()" style="right:60px;position:fixed;z-index:999" type="success">查看质量评估</el-button>
        <div style="margin:20px">
          <div style="width:80px;float:left;line-height:40px;margin-bottom:10px;text-align:right">批评人：</div>
          <el-radio-group v-model="pipingren" style="float:left">
            <el-radio-button label="全部"></el-radio-button>
            <el-radio-button v-for="(item, index) in huishangdata.LingDaoName" :key="index" keys :label="item.Name" ></el-radio-button>
          </el-radio-group><div style="float:left;line-height:40px"> &nbsp;&nbsp;&nbsp;&nbsp;共 <b>{{SumPipingWenti}}</b> 条问题</div>
          <div style="height:10px;"></div>
          <div style="width:80px;float:left;clear:both;line-height:40px;margin-bottom:20px;text-align:right">被批评人：</div>
          <el-radio-group v-model="beipipingren" style="float:left">
            <el-radio-button label="全部"></el-radio-button>
            <el-radio-button v-for="(item, index) in huishangdata.LingDaoName" :key="index" keys :label="item.Name" ></el-radio-button>
          </el-radio-group>
        </div>
        <div style="clear:both"></div>
        <el-card v-for="(item, index) in filterList" :key="index" keys class="" style="margin:0 0 20px 0">
          <div slot="header" class="clearfix">
            <b>{{index + 1}}.</b><span>&nbsp;&nbsp;<b>批评人：</b><font style="color:#00f">{{item.BanziPersonName}}</font></span>&nbsp;&nbsp;&nbsp;&nbsp;
            <span><b>被批评人：</b><font style="color:#00f">{{item.ToBanziPersonName}}</font></span>
          </div>
          <div class="text item" style="line-height:180%;font-weight:bolder">
            批评内容（{{item.Tiaoshu}}条）：
          </div>
          <div class="text item" style="line-height:180%" v-html="item.Wenti">
          </div>
          <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
          <div class="text item" style="line-height:180%;">
            <span><b>是否真点问题、点真问题：</b><font>{{item.Shifouzhendianwenti}}</font></span>
          </div>
          <div class="text item" style="line-height:180%;">
            <span><b>是否存在以提希望代替点问题现象：</b><font>{{item.Shifouxiwang}}</font></span>
          </div>
          <div class="text item" style="line-height:180%;">
            <span><b>是否存在以工作建议代替批评意见现象：</b><font>{{item.Shifoujianyi}}</font></span>
          </div>
          <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
          <div class="text item" style="line-height:180%;font-weight:bolder">
            备注：
          </div>
          <div class="text item" style="line-height:180%">
            {{item.Remark}}
          </div>
        </el-card>
      </div>
      <div v-else style="padding:20px; font-size:14px;color:#999;text-align:center">暂无数据</div>
    </el-tab-pane>
    <el-tab-pane name="HS_ChengYuanBaoGao">
      <span slot="label">班子成员&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>报告情况 <i class="el-icon-caret-bottom"></i></span>
      <div v-if="huishangdata.HS_ChengYuanBaoGao && huishangdata.HS_ChengYuanBaoGao.length > 0">
          <el-button  @click="pinggushow()" style="right:60px;position:fixed;z-index:999" type="success">查看质量评估</el-button>
        <el-radio-group v-model="BanziBaogao" style="margin:20px">
          <el-radio-button label="全部"></el-radio-button>
          <el-radio-button v-for="(item, index) in huishangdata.LingDaoName" :key="index" keys :label="item.Name" ></el-radio-button>
        </el-radio-group> 共 <b>{{SumBaogaoTiaoshu}}</b> 条问题
        <el-card v-for="(item, index) in bgfilterList" :key="index" keys class="" style="margin:0 0 20px 0">
          <div slot="header" class="clearfix">
            <span><b>班子成员姓名：</b><font style="color:#00f">{{item.BanziPersonName}}</font></span>
          </div>
          <div class="text item" style="line-height:180%">
            <span><b>是否对本人重大事项、配偶子女从业情况逐项作出说明：</b>{{item.Shifouzhongdashixiang}}</span>
          </div>
          <div class="text item" style="line-height:180%">
            <span><b>是否对巡视反馈、组织约谈函询等问题逐项作出说明：</b>{{item.Shifouxunshifankui}}</span>
          </div>
          <div class="text item" style="line-height:180%">
            <span><b>是否对查摆形式主义、官僚主义问题作出说明：</b>{{item.Shifouxingshizhuyi}}</span>
          </div>
          <div class="text item" style="line-height:180%">
            <span><b>是否对利用名贵特产类特殊资源谋取私利问题作出说明：</b>{{item.Shifoumingguitechan}}</span>
          </div>
          <div class="text item" style="line-height:180%">
            <span><b>是否对上年度民主生活会整改措施落实情况逐项做出报告：</b>{{item.Shifouzhuxiangbaogao}}</span>
          </div>
          <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
          <div class="text item" style="line-height:180%;font-weight:bolder">
            上年度生活会问题（{{item.Tiaoshu}}条）：
          </div>
          <div class="text item" style="line-height:180%" v-html="item.Shangnianwenti">
          </div>
          <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
          <div class="text item" style="line-height:180%;font-weight:bolder">
            上年度民主生活会提出的整改措施：
          </div>
          <div class="text item" style="line-height:180%" v-html="item.Shangniancuoshi">
          </div>
          <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
          <div class="text item" style="line-height:180%">
            <span><b>完成整改落实情况：</b>{{item.Wanchengqingkuang}}</span>
          </div>
          <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
          <div class="text item" style="line-height:180%;font-weight:bolder">
            备注：
          </div>
          <div class="text item" style="line-height:180%">
            {{item.Remark}}
          </div>
        </el-card>
      </div>
      <div v-else style="padding:20px; font-size:14px;color:#999;text-align:center">暂无数据</div>
    </el-tab-pane>
  </el-tabs>
  </div>
</template>
<script>
export default {
  props: {
    timestamp: ''
  },
  data () {
    return {
      activeNameHuishang: 'HS_HuiYiYiCheng',
      huishangdata: {},
      listLoading: false,
      pipingren: '全部',
      beipipingren: '全部',
      zwpipingren: '全部',
      BanziBaogao: '全部'
    }
  },
  watch: {
    timestamp (val) {
      this.loaddata()
    },
    '$store.state.link_hz' (val) {
      this.activeNameHuishang = this.$store.state.link_hz
    }
    // $refs.tree2.getCurrentNode()
  },
  computed: {
    filterList: function () {
      let key = this.pipingren
      let key2 = this.beipipingren
      let oldList = this.huishangdata.HS_PiPing
      if (key === '全部' && key2 === '全部') {
        return oldList
      }
      if (key2 === '全部') {
        return oldList.filter(function (item) {
          return item.BanziPersonName === key
        })
      }
      if (key === '全部') {
        return oldList.filter(function (item) {
          return item.ToBanziPersonName === key2
        })
      }
      return oldList.filter(function (item) {
        return item.ToBanziPersonName === key2 && item.BanziPersonName === key
      })
    },
    zwfilterList: function () {
      let key = this.zwpipingren
      let oldList = this.huishangdata.HS_ZiWoPiPing
      if (key === '全部') {
        return oldList
      }
      return oldList.filter(function (item) {
        return item.BanziPersonName === key
      })
    },
    bgfilterList: function () {
      let key = this.BanziBaogao
      let oldList = this.huishangdata.HS_ChengYuanBaoGao
      if (key === '全部') {
        return oldList
      }
      return oldList.filter(function (item) {
        return item.BanziPersonName === key
      })
    },
    SumBaogaoTiaoshu: function () {
      let s = 0
      this.bgfilterList.forEach(function (val) {
        s += val.Tiaoshu
      })
      return s
    },
    SumZiwopipingWenti: function () {
      let s = 0
      this.zwfilterList.forEach(function (val) {
        s += val.Tiaoshu
      })
      return s
    },
    SumPipingWenti: function () {
      let s = 0
      this.filterList.forEach(function (val) {
        s += val.Tiaoshu
      })
      return s
    }
  },
  methods: {
    MyGetDateStr (date) { // author: meizz\
      let fmt = 'yyyy-MM-dd'
      if (date) {
        // date = date.replace(new RegExp(/-/gm), '/')
        let mydate = new Date(date)
        var o = {
          'M+': mydate.getMonth() + 1, // 月份
          'd+': mydate.getDate(), // 日
          'h+': mydate.getHours(), // 小时
          'm+': mydate.getMinutes(), // 分
          's+': mydate.getSeconds(), // 秒
          'q+': Math.floor((mydate.getMonth() + 3) / 3), // 季度
          'S': mydate.getMilliseconds() // 毫秒
        }
        if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (mydate.getFullYear() + '').substr(4 - RegExp.$1.length)) }
        for (var k in o) {
          if (new RegExp('(' + k + ')').test(fmt)) { fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) }
        }
        return fmt
      } else {
        return null
      }
    },
    tabClick () {
      var params = {Link_hz: this.activeNameHuishang}
      this.$store.commit('tablink_hz', params)
    },
    pinggushow () {
      var params1 = {Link1: 'Pingjia'}
      this.$store.commit('tablink1', params1)
    },
    loaddata: function () {
      let _this = this
      _this.listLoading = true
      // let para = {
      //   id: this.$route.params.id
      // }
      // var personParams = { Page: 0, Pagenum: 20, Personname: '', Unitkey: '', Sortkey: '', Isace: true, timestamp: new Date().getTime() }
      this.$http
        // .post(`/shenghuohui/unithuishang`, para)
        .get(this.$http.defaults.shenghuohuiAPI + `api/shenghuohui/unitHuiShang?unitId=` + this.$route.params.id)
        .then(function (response) {
          _this.listLoading = false
          if (response.data.success === true) {
            console.log('获取成功')
            _this.huishangdata = response.data.result
          } else {
            console.log('获取数据失败:' + response.data.message)
            _this.$message({
              message: '获取数据失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(function (error) {
          console.log(error)
          _this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
          _this.listLoading = false
        })
    }
  }
}
</script>
<style scoped>
.el-form-item{
  margin:0;
}
.el-table{
  border: 1px solid #95B8E7;
}
</style>
<style>
#tab-HS_BanZiWenTi.el-tabs__item,#tab-HS_ChengYuanBaoGao.el-tabs__item{
  height:50px;
  line-height:120%;
  padding-top:10px;
}
#huishangdiv .el-form-item__label{
  font-size:16px;
}
.chuxi{
  color:green;
}
.nochuxi{
  color:red;
}
#huiyiyicheng .el-form-item__content{
  font-size:16px;
}
</style>
